from django.db import models

from orders.models import Order
from utils.models import BaseModel


# Create your models here.


class PaymentRecord(BaseModel):

    order = models.ForeignKey(Order,related_name="payments",on_delete=models.CASCADE,verbose_name="订单")
    order_number = models.CharField(max_length=255,verbose_name="原始订单编号")
    pay_order_number = models.CharField(max_length=255,verbose_name="支付订单编号")
    trade_no = models.CharField(max_length=255,verbose_name="支付流水号")
    pay_method = models.IntegerField(verbose_name="支付方式",default=2,choices=((1,"支付宝"),(2,"微信")))
    pay_amount = models.DecimalField(max_digits=10,decimal_places=2,verbose_name="支付金额")
    pay_status = models.IntegerField(verbose_name="支付状态",default=0,choices=((0,"未支付"),(1,"支付成功"),(2,"已取消"),(3,"超时取消"))
                                      )
    pay_time = models.DateTimeField(verbose_name="支付时间",null=True,blank=True)
    pay_remark = models.CharField(max_length=255,verbose_name="支付备注",null=True,blank=True)



